import java.util.Scanner;

public class zuixiaobeishu {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n,result;
        n=in.nextLong();
        if(n <= 2)
            result = n;
        else if(n % 2 == 1)
            result = n * (n - 1) * (n - 2);
        else if(n % 3 == 0)
            result = (n - 1) * (n - 2) * (n - 3);
        else
            result = n * (n - 1) * (n - 3);

        System.out.println(result);
    }
}
